package io.bdmc.modules.bss.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.bdmc.common.annotation.SysLogger;
import io.bdmc.common.utils.R;
import io.bdmc.modules.bss.entity.DeviceMachineDisk;
import io.bdmc.modules.bss.service.IDeviceMachineDiskService;
import io.bdmc.modules.sys.controller.AbstractController;

/**
 * <p>
 * 单盘数据表 前端控制器
 * </p>
 *
 * @author 黄露
 * @since 2021-04-28
 */

// "单盘数据表", description = "单盘数据表")
@RestController
@RequestMapping("/bss/deviceMachineDisk")
public class DeviceMachineDiskController extends AbstractController {

	@Autowired
	IDeviceMachineDiskService _devicemachinediskSvs;

	@SysLogger("修改单盘数据表")
	@PostMapping("/update")
	// "修改单盘数据表", notes = "修改单盘数据表")
	@RequiresPermissions("bss:deviceMachineDisk:update")
	public R update(@RequestBody DeviceMachineDisk devicemachinedisk) {
		Boolean b = devicemachinedisk.updateById();
		return R.trueOrFalse(b);
	}

	@SysLogger("删除单盘数据表")
	@DeleteMapping("/delete/{machineDiskId}")
	// "删除单盘数据表", notes = "删除单盘数据表")
	@RequiresPermissions("bss:deviceMachineDisk:delete")
	public R delete(@PathVariable Integer machineDiskId) {
		if (machineDiskId > 0)
			_devicemachinediskSvs.removeById(machineDiskId);
		return R.ok();
	}
}
